import request from './request';
// 简单的接口封装
export const getBanner = (type) =>
  request({
    url: '/banner',
    method: 'get',
    params: {
      type,
    },
  });
export const getTopPlayList = (tag, limit = 10) =>
  request({
    url: '/top/playlist',
    method: 'get',
    params: {
      tag,
      limit,
    },
  });
export const getPersonalized = (limit) =>
  request({
    url: '/personalized',
    method: 'get',
    params: {
      limit,
    },
  });
export const getPlayListDetail = (id) =>
  request({
    url: '/playlist/detail',
    method: 'get',
    params: {
      id,
    },
  });
export const getSongDetail = (ids) =>
  request({
    url: '/song/detail',
    method: 'get',
    params: {
      ids,
    },
  });
export const getSonglyric = (id) =>
  request({
    url: '/lyric',
    method: 'get',
    params: {
      id,
    },
  });
export const getSongUrl = (id, level = 'standard') =>
  request({
    url: '/song/url/v1',
    method: 'get',
    params: {
      id,
      level,
    },
  });
// 二维码登录接口
// 获取key
export const getQrKey = () =>
  request({
    url: '/login/qr/key',
    method: 'get',
    params: {
      timestamp: Date.now(),
    },
  });
// 获取二维码
export const getQr = (key) =>
  request({
    url: '/login/qr/create',
    method: 'get',
    params: {
      key,
      qrimg: true,
      timestamp: Date.now(),
    },
  });
// 验证二维码
export const checkQr = (key) =>
  request({
    url: '/login/qr/check',
    method: 'get',
    params: {
      key,
      timestamp: Date.now(),
    },
  });
// 获取状态
export const getStatus = (cookie = '') =>
  request({
    url: '/login/status',
    method: 'get',
    params: {
      cookie,
      timestamp: Date.now(),
    },
  });
// 获取搜索的内容
export const getSearch = (keywords = '海阔天空', limit = 10) =>
  request({
    url: '/search',
    method: 'get',
    params: {
      keywords,
      limit: limit,
    },
  });
// 热搜榜
export const getHot = () =>
  request({
    url: '/search/hot/detail',
    method: 'get'
  });
// 歌手榜
export const getSonger = (offset = 0, limit = 20) =>
  request({
    url: '/top/artists',
    method: 'get',
    params: {
      offset,
      limit,
    },
  });
// 获取等级
export const getLv = (cookie = '') =>
  request({
    url: '/user/level',
    method: 'get',
    params: {
      cookie,
    },
  });
// 
// 获取用户详情
export const getUserDetail = (cookie = '', uid) =>
  request({
    url: '/user/detail',
    method: 'get',
    params: {
      cookie,
      uid
    },
  });
// 获取用户信息 , 歌单，收藏，mv, dj 数量
export const getSubcount = (cookie = '') =>
  request({
    url: '/user/subcount',
    method: 'get',
    params: {
      cookie,
    },
  });
// 获取粉丝数
export const getfolloweds = (cookie = '', uid) =>
  request({
    url: '/user/followeds',
    method: 'get',
    params: {
      cookie,
      uid
    },
  });
// 获取关注
export const getfollows = (cookie = '', uid) =>
  request({
    url: '/user/follows',
    method: 'get',
    params: {
      cookie,
      uid
    },
  });
export const getAccount = (cookie = '') =>
  request({
    url: '/user/account',
    method: 'get',
    params: {
      cookie,
    },
  });
export const getPlaylist = (cookie = '', uid) =>
  request({
    url: '/user/playlist',
    method: 'get',
    params: {
      cookie,
      uid
    },
  });
export const getPalylistDetail = (id, cookie = '') =>
  request({
    url: '/playlist/detail',
    method: 'get',
    params: {
      id,
      cookie
    },
  });
export const getRecent = (cookie = '', limit = 10) =>
  request({
    url: 'record/recent/song',
    method: 'get',
    params: {
      cookie,
      limit
    },
  });
// 最近播放的视频
export const getvideo = (cookie = '') =>
  request({
    url: '/record/recent/video',
    method: 'get',
    params: {
      cookie
    },
  });
// 获取mv的视频播放地址
export const getMvUrl = (id, r = 1080) =>
  request({
    url: '/mv/url',
    method: 'get',
    params: {
      id
    },
  });
